﻿<!DOCTYPE html>
<html>
<head>
    <title>CGI</title>
</head>
<body>
    <h1>Our Page</h1>
    <script>
        //01

        var total = 9 * 3;
        console.log(total);

        var total = 1.1 * 1.1;
        console.log(total);
        if (total != 1.21)
            console.log('BigProblem!');


        //02
        //for floating point calculation, we should use toFixed
        /*
        var total = 1.1 * 1.1;
        console.log(total);
        if (total.toFixed(2) == 1.21)
            console.log('Fixed!');
        */

        //03
        /*
        var total = 20 * NaN;
        console.log(total);

        var total = 20 * undefined;
        console.log(total);

        //null treated as zero
        var total = 20 * null;
        console.log(total);

        var total = 4 * "XYZ";
        console.log(total);

        var obj = {
            valueOf: function () { return 100; }
        };

        var total = 4 * obj;
        console.log(total);
        */

        //04
        //not throwing divide by zero error
        /*
        var total = 9 / 0;
        console.log(total);

        var total = -9 / 0;
        console.log(total);

        var total = 9 / "3";
        console.log(total);
         */

        //05
        /*
        var total = 9 % 4;
        console.log(total);

        var total = 9 % "  4  ";
        console.log(total);
        */
    </script>
</body>
</html>